package org.cyberz.jsm;

import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.Queue;



/**
 * Base class to produce FSM handlers, which are required to implement
 * the FSM transition table and logic.
 * 
 * Every handler needs to retrieve/set the status from an object via the
 * relative getter/setter methods.
 * 
 * @author Andrea Leofreddi
 */
public abstract class FsmHandler {
	/**
	 * A flag used to signal and detect reentrant input requests.
	 */
	boolean reentrantInput = false;

	/**
	 * The reentrant input queue holds invocation that should be postponed.
	 */
	Queue<Pair<Method, Object[]>> reentrantInputs = new LinkedList<Pair<Method, Object[]>>();

	public abstract String getCurrentState();

	public abstract void setCurrentState(String state_);
}
